<template>
	<view>
		<view class="op-cells">
			<view style="margin-top: 40rpx">
				<view  class="op-cell-avatar">
					<block v-if="mine.avatar">
						<image :src="mine.avatar_url" style="width: 150rpx; height: 150rpx" />
					</block>
					<block v-else>
						<image src="/static/resource/images/avatar.jpg" style="width: 150rpx; height: 150rpx" />
					</block>
				</view>
			</view>
			<view style="padding-top: 20rpx">
				<text class="user-nickname">{{ mine.nickname ? mine.nickname : '用户' + mine._id }}</text>
			</view>
		</view>
		<view class="weui-cells op-cells" style="margin-top: 20rpx">
			<view class="weui-cell">
				<view class="weui-cell__bd">我的订单</view>
				<view class="weui-cell__ft"><text @tap="toOrders" style="font-size: 26rpx">全部</text></view>
			</view>
			<view class="weui-cell" style="padding: 0">
				<view class="weui-cell__bd">
					<view class="data-cell" hover-class="weui-cell_active" @tap="toOrders" data-filt="1">
						<view class="data-icon"><image src="/static/resource/images/od_10.png" mode="widthFix" /></view>
						<view class="data-txt">待支付</view>
						<text v-if="statistic.topays > 0" class="data-cell-hint data-cell-hint-red">{{ statistic.topays }}</text>
					</view>
				</view>
				<view class="weui-cell__bd">
					<view class="data-cell" hover-class="weui-cell_active" @tap="toOrders" data-filt="2">
						<view class="data-icon"><image src="/static/resource/images/od_20.png" mode="widthFix" /></view>
						<view class="data-txt">待服务</view>
						<text v-if="statistic.todos > 0" class="data-cell-hint data-cell-hint-red">{{ statistic.todos }}</text>
					</view>
				</view>
				<view class="weui-cell__bd">
					<view class="data-cell" hover-class="weui-cell_active" @tap="toOrders" data-filt="3">
						<view class="data-icon"><image src="/static/resource/images/od_30.png" mode="widthFix" /></view>
						<view class="data-txt">已完成</view>
					</view>
				</view>
				<view class="weui-cell__bd">
					<view class="data-cell" hover-class="weui-cell_active" @tap="toOrders" data-filt="4">
						<view class="data-icon"><image src="/static/resource/images/od_40.png" mode="widthFix" /></view>
						<view class="data-txt">已取消</view>
					</view>
				</view>
			</view>
		</view>
		<view class="weui-cells op-cells" style="margin-top: 20rpx">
			<view class="weui-cell weui-cell_access" hover-class="weui-cell_active">
				<view class="weui-cell__hd">
					<image src="/static/resource/images/ic_clients.png" class="client_img"></image>
				</view>
				<view class="weui-cell__bd">服务对象管理</view>
				<view class="weui-cell__ft weui-cell__ft_in-access"></view>
			</view>
			<view class="weui-cell weui-cell_access" hover-class="weui-cell_active" @tap="showShareModal">
				<view class="weui-cell__hd">
					<image src="/static/resource/images/ic_share.png" class="client_img"></image>
				</view>
				<view class="weui-cell__bd">分享转发</view>
				<view class="weui-cell__ft weui-cell__ft_in-access"></view>
			</view>
		</view>
		<share :shareModal.sync="clone_shareModal"></share>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		data() {
			return {
				mine:{},
				statistic:{},
				filt:'',
				//转发弹框
				clone_shareModal: false
			}
		},
		async onLoad(){
			const {data} = await app.globalData.utils.request({
				url:'/User/index',
				header:{
					token: uni.getStorageSync('token')
				}
			})
			this.mine = data.mine
			console.log("data",data)
			this.statistic = data.statistic
		},
		methods: {
			//跳转到相应状态的列表页
			toOrders(e){
				app.globalData.orders_filt = e.currentTarget.dataset.filt || ''
				uni.switchTab({
					url:`../order/index`
				})
			
			},
			//分享
			showShareModal(){
				this.clone_shareModal = true
			}
		}
	}
</script>

<style>
	@import './index.css'
</style>
